﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.ComponentModel;

namespace JQuery
{
    public enum Easing
    {
        Swing
    }

    public class ResizableExtender : UIExtender
    {
        public ResizableExtender()
        {
            ChangeMetadata("Handles", new JQueryElementAttribute(null, "handles", false, @"^([news]+(, ?[news]+)?)|(\{ (ne|se|sw|nw|n|e|s|w): ?" + JQueryElementAttribute.SELECTOR_PATTERN + @"(, ?(ne|se|sw|nw|n|e|s|w): ?" + JQueryElementAttribute.SELECTOR_PATTERN + @")* \})$"));
        }

        [JQueryElement("alsoResize", true)]
        public string SynchronizeWith
        {
            get { return GetPropertyValue<string>("SynchronizeWith", null); }
            set { SetPropertyValue("SynchronizeWith", value); }
        }

        [JQueryElement("animate")]
        public bool? Animate
        {
            get { return GetPropertyValue<bool>("Animate", null); }
            set { SetPropertyValue("Animate", value); }
        }

        [JQueryElement(null, "animateDuration", false, "^[0-9]+|slow|normal|fast$")]
        public string AnimateDuration
        {
            get { return GetPropertyValue<string>("AnimateDuration", null); }
            set { SetPropertyValue("AnimateDuration", value); }
        }

        [JQueryElement("animateEasing")]
        public Easing? AnimateEasing
        {
            get { return GetPropertyValue<Easing>("AnimateEasing", null); }
            set { SetPropertyValue("AnimateEasing", value); }
        }

        [JQueryElement("aspectRation")]
        public float? AspectRatio
        {
            get { return GetPropertyValue<float>("AspectRatio", null); }
            set { SetPropertyValue("AspectRatio", value); }
        }

        [JQueryElement("autoHide")]
        public bool? AutoHideHandle
        {
            get { return GetPropertyValue<bool>("AutoHideHandle", null); }
            set { SetPropertyValue("AutoHideHandle", value); }
        }

        [JQueryElement("ghost")]
        public bool? UseGhost
        {
            get { return GetPropertyValue<bool>("UseGhost", null); }
            set { SetPropertyValue("UseGhost", value); }
        }

        [JQueryElement("handles", false)]
        public string Handles
        {
            get { return GetPropertyValue<string>("Handles", null); }
            set { SetPropertyValue("Handles", value); }
        }

        [JQueryElement("helper")]
        public string HelperCssClass
        {
            get { return GetPropertyValue<string>("HelperCssClass", null); }
            set { SetPropertyValue("HelperCssClass", value); }
        }

        [JQueryElement("maxHeight")]
        public int? MaxHeight
        {
            get { return GetPropertyValue<int>("MaxHeight", null); }
            set { SetPropertyValue("MaxHeight", value); }
        }

        [JQueryElement("maxWidth")]
        public int? MaxWidth
        {
            get { return GetPropertyValue<int>("MaxWidth", null); }
            set { SetPropertyValue("MaxWidth", value); }
        }

        [JQueryElement("minHeight")]
        public int? minHeight
        {
            get { return GetPropertyValue<int>("MinHeight", null); }
            set { SetPropertyValue("MinHeight", value); }
        }

        [JQueryElement("minWidth")]
        public int? minWidth
        {
            get { return GetPropertyValue<int>("MinWidth", null); }
            set { SetPropertyValue("MinWidth", value); }
        }

        [JQueryEvent("start")]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DefaultValue(null)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public string OnStart
        {
            get { return GetPropertyValue<string>("OnStart", null); }
            set { SetPropertyValue("OnStart", value); }
        }

        [JQueryEvent("resize")]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DefaultValue(null)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public string OnResize
        {
            get { return GetPropertyValue<string>("OnResize", null); }
            set { SetPropertyValue("OnResize", value); }
        }

        [JQueryEvent("stop")]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DefaultValue(null)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public string OnStop
        {
            get { return GetPropertyValue<string>("OnStop", null); }
            set { SetPropertyValue("OnStop", value); }
        }

        protected override string jQueryFunction
        {
            get { return "resizable"; }
        }
    }
}
